package com.iretailer.report.web.business;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.iretailer.report.base.BaseAction;
import com.iretailer.report.dto.PageResult;
import com.iretailer.report.model.Config;
import com.iretailer.report.util.RMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Auther Bennie
 * @Date 2020/6/3 13:57
 * @Description
 */
@RestController
@RequestMapping("/business")
public class ConfigController extends BaseAction {


    @RequestMapping("/configList.action")
    public Map<String, Object> configList() {
        IPage<Config> page = new Page<>(1, Long.MAX_VALUE);
        QueryWrapper<Config> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("1", 1);
        IPage<Config> resultPage = configService.page(page, queryWrapper);
        PageResult<Config> result = new PageResult<>(resultPage.getTotal(), resultPage.getRecords());
        return RMap.ok(result);
    }

}
